#include <Wire.h>


void SlaveHandleReceive(int n) {
  Serial.print("slave received: ");
  while (Wire.available()) {
    Serial.print((char)Wire.read());
  }
  Serial.println();
}


void SlaveHandleRequest() {
  Serial.print("slave requested: ");
  Wire.write("hello for request");
  Serial.println();
}


void slave_setup() {
  Wire.begin(SLAVE_ADDR);
  Serial.begin(57600);
  Wire.onReceive(SlaveHandleReceive);
  Wire.onRequest(SlaveHandleRequest);
}


void slave_loop() {
}
